﻿@model DHQGHN.PM2.Models.DHQG.NguoiDungModel

@*@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")*@

@using (Html.BeginForm("ActionSave", "NguoiDung", FormMethod.Post, new { @id = "frmNguoiDung" }))
{
    <div class="row">
        <div class="col-md-12">
            <fieldset id="fs1" class="fs_group1" style="border-style:hidden;">
                @Html.HiddenFor(m => m.NGUOI_DUNG_ID)
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-3">
                        @Html.LabelFor(m => m.HO_VA_TEN, new { @class = "text-center", style = "" })
                        <font size="3" color="red" style="display:inline;" class="pm2-hidden">*</font>
                    </div>
                    <div class="col-md-9">
                        @Html.TextBoxFor(m => m.HO_VA_TEN, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.HO_VA_TEN)
                        </span>
                    </div>
                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-3">
                        @Html.LabelFor(m => m.TAI_KHOAN, new { @class = "text-center", style = "" })
                        <font size="3" color="red" style="display:inline;" class="pm2-hidden">*</font>
                    </div>
                    <div class="col-md-9">
                        @Html.TextBoxFor(m => m.TAI_KHOAN, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.TAI_KHOAN)
                        </span>
                    </div>
                </div>
                <div class="row" style="margin-top:5px;">
                    <div class="col-md-3">
                        @Html.LabelFor(m => m.DIEN_THOAI, new { @class = "text-center", style = "" })
                    </div>
                    <div class="col-md-9">
                        @Html.TextBoxFor(m => m.DIEN_THOAI, new { @class = "form-control  ", @autofocus = "autofocus", style = "", @maxlength = 50 })
                        <span style="color: red;">
                            @Html.ValidationMessageFor(m => m.DIEN_THOAI)
                        </span>
                    </div>
                </div>
            </fieldset>
        </div>
    </div>
}

@Scripts.Render("~/bundles/jqueryval")

<script>
    @functions{
            public string GetAntiForgeryToken()
            {
                string cookieToken, formToken;
                AntiForgery.GetTokens(null, out cookieToken, out formToken);
                return cookieToken + "," + formToken;
            }
        }
</script>
<script>
    
    var $form = $("#certification-form");
    function save() {
        var result = false;
        if ($form.valid()) {
            $.ajax({
                type: "POST",
                url: $form.attr('action'),
                data: $form.serialize(),
                dataType: '',//chú ý là form đặc biệt thì phải điền trường này
                async: false,
                headers: {
                    'VerificationToken': '@GetAntiForgeryToken()'
                },
                success: function (response) {
                    if (response != null && response.status == 200) {                        
                        window.notice(response.result, window.notice_success);
                        alert("here");
                        OnCriteria(0);
                        result = true;
                    } else {
                        window.notice(response.result, window.notice_error);
                    }
                }
            });
        }
        return result;
    }
</script>

